package com.example.sunsg.okhttptest;

import android.app.Application;
import android.os.*;

import com.example.sunsg.okhttptest.util.DeviceUtils;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.stetho.Stetho;
import com.squareup.leakcanary.LeakCanary;

import org.litepal.LitePalApplication;

/**
 * Created by sunsg on 15/9/21.
 */
public class TheApplication extends LitePalApplication{
    private static TheApplication mInstance;
    @Override
    public void onCreate() {

        super.onCreate();

        mInstance = this;
        String processName = DeviceUtils.getProcessName(this, android.os.Process.myPid());
        if (processName.equals(getPackageName())) {
            Fresco.initialize(this);
            initStetho();
            initLeakCanary();
        }
    }

    public static TheApplication getApplication(){
        return mInstance;
    }

    private void  initLeakCanary(){
        LeakCanary.install(this);
    }

    private void initStetho(){
        //chrome 日至查看
        Stetho.initializeWithDefaults(this);
    }


}
